<template>
  <div>
    <template01 v-if="template.type=='template01'" :template="template.template"></template01>
  </div>
</template>
<script>
import template01 from "./template01.vue";

export default {
  components: {
    template01
  },
  props: {
    template: {
      type: Object,
      default: function() {
        return { type: "template01", template: [] };
      }
    },
    data: {
      type: Object,
      default: function() {
        return {};
      }
    },
    defaultEditStatus: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      dataTemp: {},
      editStatus: false
    };
  },
  created() {
    this.editStatus = this.defaultEditStatus;
    this.redata();
  },
  methods: {
    changeEditStatus() {
      if (this.editStatus) {
        this.redata();
      }
      this.editStatus = !this.editStatus;
    },
    redata() {
      this.dataTemp = JSON.parse(JSON.stringify(this.data));
    }
  }
};
</script>
